import sys
import multiprocessing as mp
import base64
import traceback
import time

import threading
import queue
import random

from face_recog.insightface.deploy import face_model
from utils import log_util

class FaceFeatureThread(object):

    def __init__(self, args, dictProperties):
        # self.q = mp.Queue(maxsize=10)

        self.args = args
        self.embedding_model = face_model.FaceModel(self.args)

    def get_feature(self, img):
        log_util.logger.debug('人脸特征提取-获取特征开始')
        try:
            feature = self.embedding_model.get_feature(img)
            print(feature.shape)
            log_util.logger.debug('人脸特征提取-获取特征结束')
            return None, feature
        except Exception as e1:
            print('-------get feature error')
            return (90099, '服务超时'), None